<include file="Public:header" />
<div class="page-member subpage">
    <div class="form-header">
        <div>
            <div class="line1">
                <div class="fl"><h3>小区租金信息列表</h3></div>
                <div class="fr">
                    <form class="search-form" method="post" action="">
                        <span>查询条件:</span>
                        <select name="field">
                            <option value="name" <if condition="$filter.field eq 'name'">selected="selected"</if>>小区名称</option>
                            <option value="addr" <if condition="$filter.field eq 'addr'">selected="selected"</if>>小区地址</option>
                        </select>
                        <input name="value" value="{$filter.value}" type="text" placeholder="输入关键字按回车" />
                        <input name="page" value="{$filter.page}" type="hidden" />
                        <input name="order_field" value="{$filter.order_field}" type="hidden" />
                        <input name="order_sort" value="{$filter.order_sort}" type="hidden" />
                        <button class="btn-normal" type="submit">查 询</button>
                    </form>
                </div>
            </div>
            <div class="line2">
                <div class="fl form-btn-group">
                    <in name="$x|default='03-03-18'" value="$rightsCode">
                        <button onclick="showDialog();" class="btn-save btn-highlight">调整租金</button>
                        <else />
                        <button disabled="disabled" class="btn-save btn-disable">调整租金</button>
                    </in>
                </div>
                <div class="fl form-btn-more">
                    <button class="btn-normal btn-more">更多操作<i class="drop-down"></i></button>
                    <ul class="more-action hidden">
                        <li><a onclick="action_del();" href="javascript:void(0);">删 除</a></li>
                    </ul>
                </div>
                <div class="fr form-search-count">
                    <span class="offset">({$page.from}-{$page.to})</span>
                    <span class="total">共{$page.total}条</span>
                    <button onclick="PageJump({$page.prevPage});" class="btn-normal">上一页</button>
                    <button onclick="PageJump({$page.nextPage});" class="btn-normal">下一页</button>
                </div>
            </div>
        </div>
    </div>
    <div class="form-box">
        <table class="list">
            <thead>
                <tr>
                    <th width="3%"><input id="select-all" type="checkbox" /></th>
                    <th width="16%" class="list-header" field="name" sort="{$filter.order_sort}">
                        小区名称<if condition="$filter.order_field eq 'name'"><i class="icon-{$filter.order_sort}"></i></if>
                    </th>
                    <th width="12%" field="area_id" sort="{$filter.order_sort}">
                        辖区名称<if condition="$filter.order_field eq 'area_id'"><i class="icon-{$filter.order_sort}"></i></if>
                    </th>
                    <th width="12%" field="no" sort="{$filter.order_sort}">
                        小区编号<if condition="$filter.order_field eq 'no'"><i class="icon-{$filter.order_sort}"></i></if>
                    </th>
                    <th width="20%" field="zj" sort="{$filter.order_sort}">
                        租金标准(元/平米)<if condition="$filter.order_field eq 'zj'"><i class="icon-{$filter.order_sort}"></i></if>
                    </th>
                    <th width="20%" field="zj" sort="{$filter.order_sort}">
                        市场租金标准(元/平米)<if condition="$filter.order_field eq 'zj'"><i class="icon-{$filter.order_sort}"></i></if>
                    </th>
                    <th field="zjtime" sort="{$filter.order_sort}">
                        租金执行日期<if condition="$filter.order_field eq 'zjtime'"><i class="icon-{$filter.order_sort}"></i></if>
                    </th>
                </tr>
            </thead>
            <tbody>
                <volist name="list" id="vo" key="index">
                    <tr class="community-info" offset="{$vo.offset}" data-id="{$vo.id}">
                        <td class="checkbox-cell"><input class="checkbox" data-id="{$vo.id}" type="checkbox" /></td>
                        <td>{$vo.name}</td>
                        <td>{$area[$vo[area_id]]}</td>
                        <td>{$vo.no}</td>
                        <td>{$vo.zj}</td>
                        <td>{$vo.mzj}</td>
                        <td>{$vo.zjtime}</td>
                    </tr>
                </volist>
            </tbody>
        </table>
    </div>
</div>
<div class="dialog hidden">
    <div class="box">
        <div class="title">
            <h4 class="fl">调整租金对话框</h4>
            <span class="fr"><a href="#" onclick="closeDialog();">关闭</a></span>
        </div>
        <table class="form-tab">
            <tr>
                <th>租金标准：</th>
                <td><input type="text" name="zj" />
                    <label>元/平方米</label>
                </td>
            </tr>
            <tr>
                <th>市场租金标准：</th>
                <td><input type="text" name="mzj" />
                    <label>元/平方米</label>
                </td>
            </tr>
            <tr>
                <th>租金执行日期：</th>
                <td><input type="text" name="zjtime" value="{$ctime|default=time()|date='Y/m/d',###}" /></td>
            </tr>
            <tr><td colspan="2" style="text-align: center;line-height:40px;">
                <button class="btn btn-highlight" onclick="action_submit();">提交</button>
                <span>或</span>
                <a href="#" onclick="closeDialog();" class="linkBtn">放弃</a>
            </td></tr>
        </table>
    </div>
</div>
<script>
    function action_submit(){
        var dataIds = new Array();
        $("input[class=checkbox]").each(function(){ //由于复选框一般选中的是多个,所以可以循环输出
            if($(this).is(":checked")){
                dataIds.push( $(this).attr("data-id") );
            }
        });
        var data = {
            zj: $("input[name=zj]").val(),
            mzj: $("input[name=mzj]").val(),
            zjtime: $("input[name=zjtime]").val(),
        };
        if(isNaN(data.zj)){
            alert("租金标准不是有效的数字");
            $("input[name=zj]").focus();
            return false;
        }
        if(isNaN(data.mzj)){
            alert("市场租金标准不是有效的数字");
            $("input[name=mzj]").focus();
            return false;
        }
        if(!data.zjtime){
            alert("请填写租金执行日期");
            $("input[name=zjtime]").focus();
            return false;
        }
        $.ajax({
            url:"/admin/rental/ajax_updateZj",
            data: {dataIds:dataIds, data:data}, type:"POST", dataType:"JSON",
            success: function(data){
                if(data.status){
                    alert("操作成功");
                    window.location.reload();
                }else{
                    alert(data.info);
                }
            }
        });
    }
</script>
<script src="__JS__/rental.js" type="text/javascript" ></script>
<include file="Public:footer" />

